import { defineConfig } from 'vitepress';

export default defineConfig({
  lang: 'zh-Hans',
  title: 'ArchaiNexus',
  description: 'ArchaiNexus & Vue powered static site generator.',
  base: '/docs/',
  lastUpdated: true,
  cleanUrls: true,
  markdown: {
    toc: {
      level: [1, 2, 3, 4, 5, 6], // 显示 1-6 级标题
    },
  },
  outDir: './.vitepress/docs',
  head: [
    ['meta', { name: 'theme-color', content: '#3c8772' }],
    [
      'script',
      {
        src: 'https://cdn.usefathom.com/script.js',
        // 'data-site': 'AZBRSFGG',
        'data-spa': 'auto',
        defer: '',
      },
    ],
  ],

  themeConfig: {
    logo: { src: '/archai-nexus-logo.png', width: 50 },
    nav: nav(),
    search: {
      provider: 'local',
      options: {
        locales: {
          'zh-Hans': {
            translations: {
              button: {
                buttonText: '搜索文档',
                buttonAriaLabel: '搜索文档',
              },
              modal: {
                noResultsText: '无法找到相关结果',
                resetButtonTitle: '清除查询条件',
                footer: {
                  selectText: '选择',
                  navigateText: '切换',
                },
              },
            },
          },
        },
      },
    },
    sidebar: {
      '/guide/': sidebarGuide(),
      '/components/': sidebarComponents(),
    },
    socialLinks: [
      {
        icon: 'gitee',
        link: 'https://gitee.com/archai-nexus-team/m3pj0spvqw',
        ariaLabel: 'cool link',
      },
    ],

    footer: {
      message: '基于 MIT 许可发布',
      copyright: `版权所有 © 2025 神枢原道`,
    },

    docFooter: {
      prev: '上篇',
      next: '下篇',
    },

    outline: {
      label: '导览',
    },

    lastUpdated: {
      text: '末修于',
      formatOptions: {
        dateStyle: 'medium',
        timeStyle: 'medium',
      },
    },

    langMenuLabel: '多语言',
    returnToTopLabel: '归至顶',
    sidebarMenuLabel: '索录',
    darkModeSwitchLabel: '宗',
    lightModeSwitchTitle: '易明色',
    darkModeSwitchTitle: '易幽色',
    skipToContentLabel: '转至文',
  },
});

function nav() {
  return [
    { text: '神思之引', link: '/guide/what-is', activeMatch: '/guide/' },
    {
      text: '构建之篇',
      items: [
        {
          // 该部分的标题
          text: '',
          items: [
            {
              text: '通变之意',
              link: '/guide/document/report-designer-spring-boot-starter',
            },
          ],
        },
      ],
    },
  ];
}
function sidebarComponents() {
  return [];
}
function sidebarGuide() {
  return [
    {
      text: '序志之述',
      collapsed: false,
      items: [
        { text: '神思之引', link: '/guide/what-is' },
        { text: '视境之凭', link: '/guide/env' },
        { text: '见志之书', link: '/guide/getting-started' },
        { text: '稽考之录', link: '/guide/reference' },
      ],
    },
    {
      text: '构建之篇',
      collapsed: false,
      items: [
        {
          text: '通变之意',
          link: '/guide/document/report-designer-spring-boot-starter',
        },
      ],
    },
  ];
}

function sidebarRef() {
  return [
    {
      text: '构建之篇',
      collapsed: false,
      items: [
        {
          text: '通变',
          link: '/guide/document/report-designer-spring-boot-starter',
        },
      ],
    },
  ];
}
